S = input('Введите последовательность скобок: ')
obr = '(){}[]<>'
S1 = []
S2 = []
S3 = []
S4 = []
S5 = []
S6 = []
S7 = []
S8 = []
S9 = []

for i in S:
    if not i in obr:
        print('False')
        break
    if i == '(':
        S1.append(i)
    if i == ')':
        S2.append(i)
    if i == '[':
        S3.append(i)
    if i == ']':
        S4.append(i)
    if i == '{':
        S5.append(i)
    if i == '}':
        S6.append(i)
    if i == '<':
        S7.append(i)
    if i == '>':
        S8.append(i)
if len(S1) != len(S2) or len(S3) != len(S4) or len(S5) != len(S6) or len(S7) != len(S8):
    print('False')
